import { ADD_COUNTER, ADD_TO_CART } from "./mutationsType";

const mutations = {
    [ADD_COUNTER] (state, payload) {
        payload.count++
    },
    [ADD_TO_CART] (state, payload) {
        state.cartList.push(payload)
    }
}

export default mutations

// addCart (state, info) {
//     const oldInfo = state.cartList.find(item => item.iid === info.iid)
//     if (oldInfo) {
//         oldInfo.count += 1
//     } else {
//         info.count = 1
//         info.checked = true
//         state.cartList.push(info)
//     }
// }